set(CMAKE_CXX_STANDARD, 11)
add_definitions(-W)

# 静态链接
# set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) 

if(CMAKE_BUILD_TYPE STREQUAL "Release")
    set(CMAKE_EXE_LINKER_FLAGS "-s ${CMAKE_EXE_LINKER_FLAGS}")
endif()

add_executable(${PROJECT_NAME}
    common.h
    common.cpp
    properties.h
    properties.cpp
    jvm.h
    jvm.cpp
    main.cpp
)

# target_compile_options(${PROJECT_NAME} -Wextra -Wformat -Wformat-security -fPIC)
target_link_libraries(${PROJECT_NAME} dl)

# 设置DEBUG宏
target_compile_definitions(jstart PUBLIC $<$<CONFIG:DEBUG>:DEBUG>)

# 设置输出文件名
set_target_properties(jstart PROPERTIES 
    OUTPUT_NAME "${PROJECT_NAME}64.run"
    COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -m64" 
    LINK_FLAGS "-m64"
)